package cn.hinglo.gameclaw.data.utils;

import tk.mybatis.mapper.entity.Example;

import java.util.Map;

/**
 * @createTime: 2018/1/25
 * @author: HingLo
 * @description: 自定义的条件类
 */
public class CriteriaUtils {

    public static Example getCriteriaUtils(Class<?> clazz, Map<String, Object> condition) {
        Example example = new Example(clazz);
        Example.Criteria criteria = example.createCriteria();
        //组装条件
        for (Map.Entry<String, Object> entry : condition.entrySet()) {
            criteria.andCondition(entry.getKey(), entry.getValue());
        }
        return example;
    }
}
